package com.blb.mapper;

import com.blb.entity.Department;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author HuaHao
 * @since 2019-11-14
 */
public interface DepartmentMapper extends BaseMapper<Department> {

    /**
     * 根据pid查询所有父部门
     * @param pid
     * @return
     */
    @Select("SELECT * FROM t_department where pid = #{pid} and c_id=#{cId} ")
    List<Department> getDepartmentsByPid(@Param("pid") String pid,@Param("cId") String cId);

    /**
     * 通过父部门id找到所有子部门
     * @param dId
     * @return
     */
    List<Department> getDepartmentsById(@Param("dId") String dId);


    /**
     * 根据id修改部门
     * @param department
     */
    void updateDepartment(Department department);

}
